<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
 <script type="text/javascript" src="js/jquery.min.js"></script>
<script>
	$(document).ready(function(){
		
		 $("#btn").click(function(){
			var bid=$("#bid").val();
			var bname=$("#bname").val();
			var count=$("#count").val();
			var author=$("#author").val();
			var outdate=$("#outdate").val();
			var price=$("#price").val();
			var output=$("#output").val();
			var description=$("#description").val();
			var flag=$("#flag").val();
			
			var json={"bid":bid,
					"bname":bname,
					"count":count,
					"author":author,
					"outdate":outdate,
					"price":price,
					"output":output,
					"description":description,
					"flag":flag};
			$.ajax({
				url:"book/insert",
				type:"post",
				data:JSON.stringify(json),
				contentType:"application/json;charset=utf-8",
				success:function(result){
					alert(result);
				}
			})
		}) 
		//一次性获取整个form表单的数据
	
	})
</script>
</head>
<body>
图书添加页面
<form id="info" >
  	书本编号：<input type="text" name="bid" id="bid"><br/>	
  	书本名称：<input type="text" name="bname" id="bname"><br/>	
  	书本入库数量：<input type="text" name="count" id="count"><br/>
           作者：<input type="text" name="author" id="author"><br/>
  	出版日期：<input type="text" name="outdate" id="outdate"><br/>
  	价格：<input type="text" name="price" id="price"><br/>
  	出版社：<input type="text" name="output" id="output"><br/><br/>
  	书籍描述：<input type="text" name="description" id="description"><br/><br/>
  	书本状态：<input type="text" name="flag" id="flag"><br/>
  		
  </form>
  <button id="btn">提交</button>
</body>
</html>